package com.team7.order.controller;


import com.team7.order.service.PayService;
import com.team7.order.utils.CommonResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/order/pay")
public class WXPayController {

    @Resource
    private PayService payService;

    /**
     * 生成支付的二维码接口
     * @param
     * @return
     */
    @PostMapping("/createWeiXin/{id}/{HuiYuanId}")
    public CommonResult createWeiXin(@PathVariable("id") String id,@PathVariable("HuiYuanId") String HuiYuanId){
        System.out.println("控制层会员id"+HuiYuanId);
        CommonResult weiXin = payService.createWeiXin(id, HuiYuanId);
        return weiXin;
    }
    //获取支付的状态
    @PostMapping("getPayStatus/{orderNo}")
    public CommonResult getPayStatus(@PathVariable String orderNo){
        return payService.getStatus(orderNo);
    }

}
